package com.ctrip.study.algorithm.recursion;

import org.junit.Test;

import junit.framework.TestCase;

public class Factorial extends TestCase{

	public int factorial(int i){
		if(i == 1){
			return 1;
		}
		return i * factorial(i - 1);
	}
	
	@Test
	public void test(){
		assertEquals(362880, factorial(9));
		assertEquals(120, factorial(5));
	}
	
}
